package com.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author: htj
 * @Date: 2021/10/6 0006 上午 1:27
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        //要拦截的请求路径
        String[] addPathPatterns = {
                "/handleRequest/**"
        };
        //不用拦截的
        String[] excludePathPatterns = {};

        registry.addInterceptor(new RequestInterceptor()).addPathPatterns(addPathPatterns);
    }
}
